<template>
  <div>
    <detail :markdown="detail.content"/>
  </div>
</template>

<script>
import Detail from '@/components/detail.vue'
import axios from 'axios'
axios.defaults.baseURL = 'http://localhost:8083/api'

export default {
  components: {
    Detail
  },
  layout: 'admin',
  data () {
    return {
      detail: {
        title: '',
        cover: '',
        createTime: 0,
        content: ''
      }
    }
  },
  async asyncData ({ query, error }) {
    let data = await axios.get('/article/admin/detail', {params: {id: query.id}})
    return {
      detail: data.data
    }
  },
  // created () {
  //   axios.get('/article/detail', {
  //     params: {
  //       id: this.$route.query.id
  //     }
  //   }).then(res => {
  //     console.log(res.data)
  //   })
  // }
}
</script>
